package com.sleepcamel.resteasyConfigurator.util;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;

public class StringCaseInsensitiveSort extends ViewerSorter {

	@Override
	public int compare(Viewer viewer, Object e1, Object e2) {
		if ( e1 == null || e2 == null || !(e1 instanceof String) || !(e2 instanceof String) )
			return 0;
		
		return ((String) e1).toLowerCase().compareTo(((String) e2).toLowerCase());
	}
}
